﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

// NotReviewedButNeeded
#pragma once

#include "GcmpCommonEdit.h"
#include "IGraphicsNodeReference.h"

namespace gcmp
{
    class IDocument;
    class IUiView;
    class IActionInputEventArgs;
    class ICurve3d;
    class IPlane;
    class IGraphicsNodeGroup;
    class IPickFilter;
    class IControlDefinition;
    class Coordinate3d;
    class IPolyCurve;

    /// \brief 偏移操作的Behavior，方便定制偏移Action的行为。
    class GCMP_COMMON_EDIT_EXPORT IActionOffsetBehavior
    {
    public:
        /// \brief 析构函数
        virtual ~IActionOffsetBehavior(){}


        /// \brief 输入对话框特性相关方法
    public:
        /// \brief 定义Action输入对话框UI
        /// \param title [out] 对话框标题
        /// \param inputItems [out] 对话框配置项UI
        /// \return 定制成功则返回true，否则返回false
        virtual bool DefineInputDialog(std::wstring &title, std::vector<OwnerPtr<IControlDefinition>>& inputItems) = 0;

        /// \brief 对话框UI事件处理
        /// \param pArgs 输入事件参数
        /// \return 定制成功则返回true，否则返回false
        virtual bool OnActionInputEvent(IActionInputEventArgs* pArgs) = 0;

        /// \brief 通用操作（Action）状态特性方法
    public:
        /// \brief 偏移操作完成行为定制
        /// \param pDocument 当前Action运行所属的文档
        /// \param pWorkPlane 当前工作平面
        /// \param gNodeReferencesSelection 偏移所操作的选择集
        /// \param vecOffsetElementCurve 偏移对象Id和对应偏移后的与Curve,若Id为无效值表示为因偏移而增加的Curve,若Curve为空指针表示因偏移而删除的Curve
        /// \return 定制成功则返回true，否则返回false
        virtual bool OnOffsetFinished(gcmp::IDocument* pDocument,
            const IPlane* pWorkPlane,
            const gcmp::GraphicsNodeReferenceOwnerPtrVector& gNodeReferencesSelection,
            const std::vector<std::pair<ElementId, std::vector<OwnerPtr<ICurve3d>>>>& offsetElementCurves) = 0;

        /// \brief 多段线偏移操作完成行为定制
        /// \param pDocument 当前Action运行所属的文档
        /// \param coordinate 多段线所在坐标系
        /// \param gNodeReferencesSelection 偏移所操作的选择集
        /// \param offsetPolyCurves 偏移后的多段线几何数据
        /// \return 定制成功则返回true，否则返回false
        virtual bool OnOffsetFinished(gcmp::IDocument* pDocument,
            const Coordinate3d& coordinate,
            const gcmp::GraphicsNodeReferenceOwnerPtrVector& gNodeReferencesSelection,
            const std::vector<OwnerPtr<IPolyCurve>>& offsetPolyCurves) = 0;

        /// \brief 预览显示特性方法
    public:
        /// \brief 偏移操作预览行为定制
        /// \param pCurrentView 当前Action运行所属的视图
        /// \param mousePoint 本次拾取操作后，拾取点的模型空间坐标
        /// \param vecOpCurve 用于预览的偏移后临时对象的Curve3d
        /// \param opGNodeGroup [in, out] 用来预览的表达数据
        /// \return 定制成功则返回true，否则返回false
        virtual bool OnUpdatePreview(gcmp::IUiView* pCurrentView,
            const gcmp::Vector3d& mousePoint,
            const std::vector<OwnerPtr<gcmp::ICurve3d>>& opCurves, 
            OwnerPtr<IGraphicsNodeGroup>& opGNodeGroup) = 0;

        /// \brief 多段线偏移操作预览行为定制
        /// \param pCurrentView 当前Action运行所属的视图
        /// \param coordinate 多段线所在坐标系
        /// \param mousePoint 本次拾取操作后，拾取点的模型空间坐标
        /// \param offsetPolyCurves 用于预览的偏移后临时对象的多段线几何数据
        /// \param opGNodeGroup 用来预览的表达数据
        /// \return 定制成功则返回true，否则返回false
        virtual bool OnUpdatePreview(gcmp::IUiView* pCurrentView,
            const Coordinate3d& coordinate,
            const gcmp::Vector3d& mousePoint,
            const std::vector<OwnerPtr<IPolyCurve>>& offsetPolyCurves,
            OwnerPtr<IGraphicsNodeGroup>& opGNodeGroup) = 0;

        /// \brief 该操作特有的特性方法
    public:
        /// \brief 获取是否以固定的偏移值进行偏移的布尔值
        /// \param bIsFixed [out] 是否为固定的偏移值
        /// \return 定制成功则返回true，否则返回false
        virtual bool GetIsFixedOffsetValue(bool& isFixed) const = 0;
        
        /// \brief 获取固定的偏移值
        /// \param dOffset [out] 固定的偏移值
        /// \return 定制成功则返回true，否则返回false
        virtual bool GetFixedOffsetValue(double& offset) const = 0;

        /// \brief 获取是否为以复制形式进行偏移的布尔值
        /// \param bIsCopy [out] 是否复制
        /// \return 定制成功则返回true，否则返回false
        virtual bool GetIsCopyElementOnOffsetFinished(bool& isCopy) const = 0;

        /// \brief 获取是否是多段线的偏移情形
        /// \param isPolyLine [out] 是否是多段线
        /// \return 定制成功则返回true，否则返回false
        virtual bool GetIsPolyLineElementOnOffsetFinished(bool& isPolyLine) const = 0;

        /// \brief 获取偏移状态是否改变，直接偏移与绘制线偏移的切换
        /// \return 发生改变则返回true，否则返回false
        virtual bool GetIsActionStateChanged() const = 0;

        /// \brief 获取偏移的拾取过滤器。
        /// \param pDocument 当前文档。
        /// \return 返回偏移的拾取过滤器指针。
        virtual OwnerPtr<IPickFilter> GetOffsetPickFilter(IDocument* pDocument) const = 0;
    };
}
